//build:20240524
//To simplify the use of the capturer component, the capturer is encapsulated within this worker. Users only need to subscribe to eventbus events to listen to the capturer.
import log from './dxLogger.js'
import capturer from './dxCapturer.js'
import dxMap from './dxMap.js'
import std from './dxStd.js'
const map = dxMap.get('default')
const id = "{{id}}"
const options = map.get("__capturer__run_init" + id)

function run() {
    capturer.worker.beforeLoop(options)
    log.info('capturer start......,id =', options.id)
    std.setInterval (function() {
        try {
            capturer.worker.loop(options)
        } catch (error) {
            log.error(error)
        }
    },10)
}

try {
    run()
} catch (error) {
    log.error(error)
}